﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using OgilvyOne.Model;
using OgilvyOne.DALFactory;
using OgilvyOne.Utility;

namespace OgilvyOne.BLL
{
    /// <summary>
    /// 简介解析类
    /// </summary>
    class AboutModel : CommonModel
    {
        public AboutModel(CmsVo vo)
            : base(vo)
        {
            
        }

        //"艺述英国"盛事
        public string GetEvents()
        {
            StringBuilder sb = new StringBuilder();

            IList datalist = CmsArticleFrontFactory.create().GetArticleOrderList(vo.Cid, 0);
            
            for (int i = 0; i < datalist.Count; i++)
            {
                string cs = "ukVisualart";
                string titimg = "/cn/images/UK_1.2UK-NOW-EVENT_0";
                string conimg = "/cn/images/UK_introduction0";
                titimg = titimg + (i + 1) + ".gif";
                conimg = conimg + (i + 3) + ".jpg";
                CmsArticleModel cm = (CmsArticleModel)datalist[i];
                if (i == 1)
                {
                    cs = "ukPerformingart";
                    
                }
                else if (i == 2)
                {
                    cs = "ukFilmart";
                }
                if (!string.IsNullOrEmpty(cm.Titleimg))
                {
                    titimg = ConConstants.UPLOADFILES_IMAGE_PATH + cm.Titleimg;
                }
                IList ilist = CmsArticleFrontFactory.create().GetImgs(cm.Articleid, CmsConstants.IMG_TYPE_COMMON);
                if (ilist.Count > 0)
                {
                    CmsArticleImgModel caim = (CmsArticleImgModel)ilist[0];
                    conimg = ConConstants.UPLOADFILES_IMAGE_PATH + caim.ImgFileName;
                }

                sb.Append("<div class=\"" + cs + "\">\n");
                sb.Append("<h3><a name=\""+(i+1)+"\" id=\""+(i+1)+"\"></a><img src=\"" + titimg + "\" alt=\"\" /></h3>\n");
                sb.Append("<dl>\n");
                if (i % 2 == 0)
                {
                    sb.Append("<dt><img src=\"" + conimg + "\" alt=\"\" /></dt>\n");
                }
                sb.Append("<dd>\n");
                sb.Append(cm.Content + "\n");
                sb.Append("</dd>\n");
                if (i % 2 == 1)
                {
                    sb.Append("<dt><img src=\"" + conimg + "\" alt=\"\" /></dt>\n");
                }
                sb.Append("</dl>\n");
                sb.Append("<div class=\"clear\"></div>\n");
                sb.Append("</div>\n");
            }

            return sb.ToString();
        }
    }
}
